package com.acceptable.qucun.file.entity;

import com.acceptable.qucun.user.entity.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.lang.NonNull;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ShareInfo {
    private Integer shareId;
    private String shareTime;
    private String expireTime;
    private String url;
    private String password;
    private boolean isChecked;

    private List<FileInfo> subFileList;
    private UserInfo userInfo;

    public void setPartFieldByFileShare(@NonNull FileShare share){
        this.shareId = share.getShareId();
        this.shareTime = share.getShareTime().toString();
        this.expireTime = share.getExpireTime().toString();
        this.password = share.getPassword();
        this.url = share.getUrl();
    }

    public void setIschecked(boolean isChecked){
        this.isChecked = isChecked;
    }

    public boolean getIsChecked(){
        return this.isChecked;
    }
}
